<template>
  <div class="nav-bar">
    <p @click="active=index" :class="{active:active==index}" v-for="(item,index) in list" :key="index">{{item.title}}</p>
  </div>
</template>
<script>
import { reactive, toRefs } from "vue";
export default {
  setup(props) {
    const data = reactive({
      list: [
        { id: 1, title: "讲师介绍" },
        { id: 1, title: "主讲课程" },
        { id: 1, title: "学院评价" }
      ],
      active:0
    });
    return{...toRefs(data)}
  }
};
</script>
<style lang="scss" scoped>
.nav-bar {
  height: 63px;
  width: 100%;
  display: flex;
  justify-content: space-around;
  p{
    width: 125px;
    line-height: 63px;
    text-align: center;
    font-size: 20px;
  }
  .active{
    color:#eb6100 ;
    border-bottom: 4px solid #eb6100;
  }
}
</style>